<!DOCTYPE html>

<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Collection"%>
<%@page import="juniors.modelo.Usuario"%>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<meta name="description" content="">
		<meta name="author" content="">
		<!--     <link rel="shortcut icon" href="../../assets/ico/favicon.png"> -->
		
		<title>Idea</title>
		
		<link href="css/bootstrap-3.1.1.css" rel="stylesheet" media="screen">
		
		<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    	<!--[if lt IE 9]>
      		<script src="../../assets/js/html5shiv.js"></script>
      		<script src="../../assets/js/respond.min.js"></script>
    	<![endif]-->
	</head>
	
	<body>	
		<div class="navbar navbar-inverse navbar-static-top">
			<div class="container">
				<div class="navbar-header">
					<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
					<a class="navbar-brand" href="home.jsp">Agregar Usuarios</a>
				</div>
				<div class="navbar-collapse collapse">
					<ul class="nav navbar-nav">
						<li><a href="home.jsp">Inicio</a></li>
						<li class="dropdown active">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown">Mantenimientos<b class="caret"></b></a>
							<ul class="dropdown-menu">
								<li><a href="idea_buscar.jsp">Ideas</a></li>
							</ul>
						</li>
						<li><a href="IdeaPublicarServlet">Publicar</a></li>
						<li><a href="#">Reportes</a></li>
						<li><a href="LogoutServlet">Salir</a></li>
					</ul>
				</div>
			</div>
		</div>
		
				
			<div class="container">
				<p><strong>Publicar Idea &gt; Asignar Usuarios</strong> </p>
			
				<form id="form1" name="form1" method="post" action="IdeaUsuariosServlet" class="form-horizontal" role="form">
					
					<% int idIdea = (Integer) request.getAttribute("idIdea"); %>
					
					<input name="idIdea" hidden="true" value="<%out.print(idIdea);%>"/>
					
					<p> <label> Usuario : </label>
						<select name="usuario" style="width:300px"> 
							<%
								Collection<Usuario> arreglo = (ArrayList) request.getAttribute("listadoSA");
								if(arreglo !=null){
									int i = 1;
									for(Usuario x : arreglo){
							%>		
									<option value="<%=x.getIdUsuario()%>"> <%=x.getNombre() + ' ' + x.getApellidoPaterno() + ' ' + x.getApellidoMaterno() %> </option>	
							<%		}
								}
							%>
						</select>
						<label>
							<input type="submit" name="agregar" id="agregar" value="Agregar"/>
						</label>
					</p>
				</form>
				
				
				<div class="table-responsive">
					<table width="550" height="65" border="1" cellpadding="0" cellspacing="0" class="table table-hover">
						<tr>
							<th width="49" scope="col">Nro.</th>
							<th width="192" scope="col">Nombre Completo</th>
							<th width="107" scope="col">Perfil</th>							
						</tr>
						
						<%
							Collection<Usuario> arreglo1 = (ArrayList) request.getAttribute("listadoAG");
							if(arreglo1 != null){
								int i = 1;
								for(Usuario x : arreglo1){
						%>
							<tr>
								<td><%=i++ %></td>
								<td><% out.print(x.getNombre() + ' ' + x.getApellidoPaterno() + ' ' + x.getApellidoMaterno()); %></td>
								<td><% out.print(x.getIdPerfil().getDescripcion()); %></td>
							</tr>	
						<%		}
							}
						%>
						
						
						
					</table>
				</div>
							
			
				<!-- Site footer -->
				<div class="footer">
					<p>&nbsp;</p>
				    <p>&copy; Juniors 2014 </p>
				</div>

			</div>
			
				

		
		<!-- Bootstrap core JavaScript
	    ================================================== -->
	    <!-- Placed at the end of the document so the pages load faster -->
	    
	     <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
	    <script src="js/jquery-1.10.2.js"></script>
	    <!-- Include all compiled plugins (below), or include individual files as needed -->
	    <script src="js/bootstrap-3.1.1.js"></script>
		
	</body>
</html>